blob: 04a643b186e28bfc5e2ec9063de51001755974dd [file] [log] [blame]
Junio C Hamano1a4e8412005-12-27 08:17:231<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Junio C Hamanoba4b9282008-07-06 05:20:316<meta name="generator" content="AsciiDoc 8.2.5" />
Junio C Hamano1a4e8412005-12-27 08:17:237<style type="text/css">
8/* Debug borders */
9p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
10/*
11 border: 1px solid red;
12*/
13}
14
15body {
16 margin: 1em 5% 1em 5%;
17}
18
Junio C Hamanoba4b9282008-07-06 05:20:3119a {
20 color: blue;
21 text-decoration: underline;
22}
23a:visited {
24 color: fuchsia;
25}
Junio C Hamano1a4e8412005-12-27 08:17:2326
27em {
28 font-style: italic;
29}
30
31strong {
32 font-weight: bold;
33}
34
35tt {
36 color: navy;
37}
38
39h1, h2, h3, h4, h5, h6 {
40 color: #527bbd;
41 font-family: sans-serif;
42 margin-top: 1.2em;
43 margin-bottom: 0.5em;
44 line-height: 1.3;
45}
46
Junio C Hamanoba4b9282008-07-06 05:20:3147h1, h2, h3 {
Junio C Hamano1a4e8412005-12-27 08:17:2348 border-bottom: 2px solid silver;
49}
50h2 {
Junio C Hamano1a4e8412005-12-27 08:17:2351 padding-top: 0.5em;
52}
Junio C Hamanoba4b9282008-07-06 05:20:3153h3 {
54 float: left;
55}
56h3 + * {
57 clear: left;
58}
Junio C Hamano1a4e8412005-12-27 08:17:2359
60div.sectionbody {
61 font-family: serif;
62 margin-left: 0;
63}
64
65hr {
66 border: 1px solid silver;
67}
68
69p {
70 margin-top: 0.5em;
71 margin-bottom: 0.5em;
72}
73
74pre {
75 padding: 0;
76 margin: 0;
77}
78
79span#author {
80 color: #527bbd;
81 font-family: sans-serif;
82 font-weight: bold;
Junio C Hamanoba4b9282008-07-06 05:20:3183 font-size: 1.1em;
Junio C Hamano1a4e8412005-12-27 08:17:2384}
85span#email {
86}
87span#revision {
88 font-family: sans-serif;
89}
90
91div#footer {
92 font-family: sans-serif;
93 font-size: small;
94 border-top: 2px solid silver;
95 padding-top: 0.5em;
96 margin-top: 4.0em;
97}
98div#footer-text {
99 float: left;
100 padding-bottom: 0.5em;
101}
102div#footer-badges {
103 float: right;
104 padding-bottom: 0.5em;
105}
106
107div#preamble,
108div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
109div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
110div.admonitionblock {
111 margin-right: 10%;
112 margin-top: 1.5em;
113 margin-bottom: 1.5em;
114}
115div.admonitionblock {
116 margin-top: 2.5em;
117 margin-bottom: 2.5em;
118}
119
120div.content { /* Block element content. */
121 padding: 0;
122}
123
124/* Block element titles. */
125div.title, caption.title {
126 font-family: sans-serif;
127 font-weight: bold;
128 text-align: left;
129 margin-top: 1.0em;
130 margin-bottom: 0.5em;
131}
132div.title + * {
133 margin-top: 0;
134}
135
136td div.title:first-child {
137 margin-top: 0.0em;
138}
139div.content div.title:first-child {
140 margin-top: 0.0em;
141}
142div.content + div.title {
143 margin-top: 0.0em;
144}
145
146div.sidebarblock > div.content {
147 background: #ffffee;
148 border: 1px solid silver;
149 padding: 0.5em;
150}
151
Junio C Hamanoba4b9282008-07-06 05:20:31152div.listingblock {
153 margin-right: 0%;
154}
Junio C Hamano1a4e8412005-12-27 08:17:23155div.listingblock > div.content {
156 border: 1px solid silver;
157 background: #f4f4f4;
158 padding: 0.5em;
159}
160
161div.quoteblock > div.content {
162 padding-left: 2.0em;
163}
Junio C Hamanoba4b9282008-07-06 05:20:31164
165div.attribution {
Junio C Hamano1a4e8412005-12-27 08:17:23166 text-align: right;
167}
Junio C Hamanoba4b9282008-07-06 05:20:31168div.verseblock + div.attribution {
169 text-align: left;
170}
Junio C Hamano1a4e8412005-12-27 08:17:23171
172div.admonitionblock .icon {
173 vertical-align: top;
174 font-size: 1.1em;
175 font-weight: bold;
176 text-decoration: underline;
177 color: #527bbd;
178 padding-right: 0.5em;
179}
180div.admonitionblock td.content {
181 padding-left: 0.5em;
182 border-left: 2px solid silver;
183}
184
185div.exampleblock > div.content {
186 border-left: 2px solid silver;
187 padding: 0.5em;
188}
189
190div.verseblock div.content {
191 white-space: pre;
192}
193
194div.imageblock div.content { padding-left: 0; }
195div.imageblock img { border: 1px solid silver; }
196span.image img { border-style: none; }
197
198dl {
199 margin-top: 0.8em;
200 margin-bottom: 0.8em;
201}
202dt {
203 margin-top: 0.5em;
204 margin-bottom: 0;
205 font-style: italic;
206}
207dd > *:first-child {
208 margin-top: 0;
209}
210
211ul, ol {
212 list-style-position: outside;
213}
Junio C Hamanoba4b9282008-07-06 05:20:31214div.olist2 ol {
Junio C Hamano1a4e8412005-12-27 08:17:23215 list-style-type: lower-alpha;
216}
217
218div.tableblock > table {
Junio C Hamanoba4b9282008-07-06 05:20:31219 border: 3px solid #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23220}
221thead {
222 font-family: sans-serif;
223 font-weight: bold;
224}
225tfoot {
226 font-weight: bold;
227}
228
229div.hlist {
230 margin-top: 0.8em;
231 margin-bottom: 0.8em;
232}
Junio C Hamanoba4b9282008-07-06 05:20:31233div.hlist td {
234 padding-bottom: 5px;
235}
Junio C Hamano1a4e8412005-12-27 08:17:23236td.hlist1 {
237 vertical-align: top;
238 font-style: italic;
239 padding-right: 0.8em;
240}
241td.hlist2 {
242 vertical-align: top;
243}
244
245@media print {
246 div#footer-badges { display: none; }
247}
Junio C Hamanoba4b9282008-07-06 05:20:31248
249div#toctitle {
250 color: #527bbd;
251 font-family: sans-serif;
252 font-size: 1.1em;
253 font-weight: bold;
254 margin-top: 1.0em;
255 margin-bottom: 0.1em;
256}
257
258div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
259 margin-top: 0;
260 margin-bottom: 0;
261}
262div.toclevel2 {
263 margin-left: 2em;
264 font-size: 0.9em;
265}
266div.toclevel3 {
267 margin-left: 4em;
268 font-size: 0.9em;
269}
270div.toclevel4 {
271 margin-left: 6em;
272 font-size: 0.9em;
273}
274include1::./stylesheets/xhtml11-manpage.css[]
Junio C Hamano1a4e8412005-12-27 08:17:23275/* Workarounds for IE6's broken and incomplete CSS2. */
276
277div.sidebar-content {
278 background: #ffffee;
279 border: 1px solid silver;
280 padding: 0.5em;
281}
282div.sidebar-title, div.image-title {
283 font-family: sans-serif;
284 font-weight: bold;
285 margin-top: 0.0em;
286 margin-bottom: 0.5em;
287}
288
289div.listingblock div.content {
290 border: 1px solid silver;
291 background: #f4f4f4;
292 padding: 0.5em;
293}
294
295div.quoteblock-content {
296 padding-left: 2.0em;
297}
298
299div.exampleblock-content {
300 border-left: 2px solid silver;
301 padding-left: 0.5em;
302}
Junio C Hamanoba4b9282008-07-06 05:20:31303
304/* IE6 sets dynamically generated links as visited. */
305div#toc a:visited { color: blue; }
Junio C Hamano1a4e8412005-12-27 08:17:23306</style>
307<title>git-commit(1)</title>
308</head>
309<body>
310<div id="header">
311<h1>
312git-commit(1) Manual Page
313</h1>
314<h2>NAME</h2>
315<div class="sectionbody">
316<p>git-commit -
Junio C Hamano7c73c662007-01-19 00:37:50317 Record changes to the repository
Junio C Hamano1a4e8412005-12-27 08:17:23318</p>
319</div>
320</div>
321<h2>SYNOPSIS</h2>
322<div class="sectionbody">
Junio C Hamano235a91e2006-01-07 01:13:58323<div class="verseblock">
Junio C Hamano1bb31992009-08-29 04:24:08324<div class="content"><em>git commit</em> [-a | --interactive] [-s] [-v] [-u&lt;mode&gt;] [--amend] [--dry-run]
Junio C Hamano2bd8a742009-12-01 21:16:59325 [(-c | -C) &lt;commit&gt;] [-F &lt;file&gt; | -m &lt;msg&gt;] [--reset-author]
Junio C Hamanocb39aea2010-05-09 07:24:48326 [--allow-empty] [--allow-empty-message] [--no-verify] [-e] [--author=&lt;author&gt;]
Junio C Hamano6ce6b6c2010-01-18 01:25:50327 [--date=&lt;date&gt;] [--cleanup=&lt;mode&gt;] [--status | --no-status] [--]
328 [[-i | -o ]&lt;file&gt;&#8230;]</div></div>
Junio C Hamano1a4e8412005-12-27 08:17:23329</div>
Junio C Hamanoba4b9282008-07-06 05:20:31330<h2 id="_description">DESCRIPTION</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23331<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31332<div class="para"><p>Stores the current contents of the index in a new commit along
333with a log message from the user describing the changes.</p></div>
334<div class="para"><p>The content to be added can be specified in several ways:</p></div>
335<div class="olist"><ol>
Junio C Hamanoe7935c42006-12-13 21:32:17336<li>
337<p>
Junio C Hamano1aa40d22010-01-21 17:46:43338by using <em>git add</em> to incrementally "add" changes to the
Junio C Hamanob515b6a2007-08-08 09:21:16339 index before using the <em>commit</em> command (Note: even modified
340 files must be "added");
341</p>
342</li>
343<li>
344<p>
Junio C Hamano1aa40d22010-01-21 17:46:43345by using <em>git rm</em> to remove files from the working tree
Junio C Hamanobd2b4bb2007-08-06 06:42:24346 and the index, again before using the <em>commit</em> command;
Junio C Hamanoe7935c42006-12-13 21:32:17347</p>
348</li>
349<li>
350<p>
Junio C Hamanobd2b4bb2007-08-06 06:42:24351by listing files as arguments to the <em>commit</em> command, in which
352 case the commit will ignore changes staged in the index, and instead
Junio C Hamano50819852008-11-19 02:07:56353 record the current content of the listed files (which must already
354 be known to git);
Junio C Hamanoe7935c42006-12-13 21:32:17355</p>
356</li>
357<li>
358<p>
Junio C Hamanobd2b4bb2007-08-06 06:42:24359by using the -a switch with the <em>commit</em> command to automatically
360 "add" changes from all known files (i.e. all files that are already
361 listed in the index) and to automatically "rm" files in the index
362 that have been removed from the working tree, and then perform the
363 actual commit;
Junio C Hamanoe7935c42006-12-13 21:32:17364</p>
365</li>
Junio C Hamanoc51fede2007-03-12 07:29:20366<li>
367<p>
368by using the --interactive switch with the <em>commit</em> command to decide one
369 by one which files should be part of the commit, before finalizing the
Junio C Hamano1aa40d22010-01-21 17:46:43370 operation. Currently, this is done by invoking <em>git add --interactive</em>.
Junio C Hamanoc51fede2007-03-12 07:29:20371</p>
372</li>
Junio C Hamanoba4b9282008-07-06 05:20:31373</ol></div>
Junio C Hamano1bb31992009-08-29 04:24:08374<div class="para"><p>The <tt>--dry-run</tt> option can be used to obtain a
Junio C Hamanoe7935c42006-12-13 21:32:17375summary of what is included by any of the above for the next
Junio C Hamano1bb31992009-08-29 04:24:08376commit by giving the same set of parameters (options and paths).</p></div>
Junio C Hamanoba4b9282008-07-06 05:20:31377<div class="para"><p>If you make a commit and then find a mistake immediately after
Junio C Hamano1aa40d22010-01-21 17:46:43378that, you can recover from it with <em>git reset</em>.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23379</div>
Junio C Hamanoba4b9282008-07-06 05:20:31380<h2 id="_options">OPTIONS</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23381<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31382<div class="vlist"><dl>
Junio C Hamano1a4e8412005-12-27 08:17:23383<dt>
Junio C Hamanoeb415992008-06-08 22:49:47384-a
385</dt>
386<dt>
387--all
Junio C Hamano1a4e8412005-12-27 08:17:23388</dt>
389<dd>
390<p>
Junio C Hamanoe7935c42006-12-13 21:32:17391 Tell the command to automatically stage files that have
392 been modified and deleted, but new files you have not
393 told git about are not affected.
Junio C Hamano1a4e8412005-12-27 08:17:23394</p>
395</dd>
396<dt>
Junio C Hamanoeb415992008-06-08 22:49:47397-C &lt;commit&gt;
398</dt>
399<dt>
400--reuse-message=&lt;commit&gt;
Junio C Hamano1a4e8412005-12-27 08:17:23401</dt>
402<dd>
403<p>
Junio C Hamanoeb415992008-06-08 22:49:47404 Take an existing commit object, and reuse the log message
Junio C Hamano1a4e8412005-12-27 08:17:23405 and the authorship information (including the timestamp)
Junio C Hamanoeb415992008-06-08 22:49:47406 when creating the commit.
407</p>
408</dd>
409<dt>
410-c &lt;commit&gt;
411</dt>
412<dt>
413--reedit-message=&lt;commit&gt;
414</dt>
415<dd>
416<p>
417 Like <em>-C</em>, but with <em>-c</em> the editor is invoked, so that
418 the user can further edit the commit message.
Junio C Hamano1a4e8412005-12-27 08:17:23419</p>
420</dd>
421<dt>
Junio C Hamano2bd8a742009-12-01 21:16:59422--reset-author
423</dt>
424<dd>
425<p>
426 When used with -C/-c/--amend options, declare that the
427 authorship of the resulting commit now belongs of the committer.
428 This also renews the author timestamp.
429</p>
430</dd>
431<dt>
Junio C Hamanoa0fae262009-12-28 09:33:50432--short
433</dt>
434<dd>
435<p>
436 When doing a dry-run, give the output in the short-format. See
437 <a href="git-status.html">git-status(1)</a> for details. Implies <tt>--dry-run</tt>.
438</p>
439</dd>
440<dt>
441--porcelain
442</dt>
443<dd>
444<p>
445 When doing a dry-run, give the output in a porcelain-ready
446 format. See <a href="git-status.html">git-status(1)</a> for details. Implies
447 <tt>--dry-run</tt>.
448</p>
449</dd>
450<dt>
451-z
452</dt>
453<dd>
454<p>
455 When showing <tt>short</tt> or <tt>porcelain</tt> status output, terminate
456 entries in the status output with NUL, instead of LF. If no
457 format is given, implies the <tt>--porcelain</tt> output format.
458</p>
459</dd>
460<dt>
Junio C Hamano1a4e8412005-12-27 08:17:23461-F &lt;file&gt;
462</dt>
Junio C Hamanoeb415992008-06-08 22:49:47463<dt>
464--file=&lt;file&gt;
465</dt>
Junio C Hamano1a4e8412005-12-27 08:17:23466<dd>
467<p>
468 Take the commit message from the given file. Use <em>-</em> to
469 read the message from the standard input.
470</p>
471</dd>
472<dt>
Junio C Hamanoeb415992008-06-08 22:49:47473--author=&lt;author&gt;
Junio C Hamano40f2f8d2006-02-07 08:04:39474</dt>
475<dd>
476<p>
Junio C Hamano13002fb2010-06-08 05:53:58477 Override the commit author. Specify an explicit author using the
478 standard <tt>A U Thor &lt;author@example.com&gt;</tt> format. Otherwise &lt;author&gt;
479 is assumed to be a pattern and is used to search for an existing
480 commit by that author (i.e. rev-list --all -i --author=&lt;author&gt;);
481 the commit author is then copied from the first such commit found.
Junio C Hamano40f2f8d2006-02-07 08:04:39482</p>
483</dd>
484<dt>
Junio C Hamanoae05fee2010-01-08 07:39:46485--date=&lt;date&gt;
486</dt>
487<dd>
488<p>
489 Override the author date used in the commit.
490</p>
491</dd>
492<dt>
Junio C Hamanoeb415992008-06-08 22:49:47493-m &lt;msg&gt;
494</dt>
495<dt>
496--message=&lt;msg&gt;
Junio C Hamano1a4e8412005-12-27 08:17:23497</dt>
498<dd>
499<p>
500 Use the given &lt;msg&gt; as the commit message.
501</p>
502</dd>
503<dt>
Junio C Hamanoeb415992008-06-08 22:49:47504-t &lt;file&gt;
505</dt>
506<dt>
507--template=&lt;file&gt;
Junio C Hamanoa3770f92007-07-25 08:53:33508</dt>
509<dd>
510<p>
511 Use the contents of the given file as the initial version
512 of the commit message. The editor is invoked and you can
513 make subsequent changes. If a message is specified using
Junio C Hamanob968dbb2007-07-27 07:26:40514 the <tt>-m</tt> or <tt>-F</tt> options, this option has no effect. This
515 overrides the <tt>commit.template</tt> configuration variable.
Junio C Hamanoa3770f92007-07-25 08:53:33516</p>
517</dd>
518<dt>
Junio C Hamanoeb415992008-06-08 22:49:47519-s
520</dt>
521<dt>
522--signoff
Junio C Hamano1a4e8412005-12-27 08:17:23523</dt>
524<dd>
525<p>
Junio C Hamano610d1762008-11-28 06:27:13526 Add Signed-off-by line by the committer at the end of the commit
Junio C Hamano7d06a8a2008-10-20 05:42:33527 log message.
Junio C Hamano1a4e8412005-12-27 08:17:23528</p>
529</dd>
530<dt>
Junio C Hamanoeb415992008-06-08 22:49:47531-n
532</dt>
533<dt>
Junio C Hamanoe7935c42006-12-13 21:32:17534--no-verify
Junio C Hamano1a4e8412005-12-27 08:17:23535</dt>
536<dd>
537<p>
Junio C Hamano942b35e2007-12-09 10:19:33538 This option bypasses the pre-commit and commit-msg hooks.
Junio C Hamanofce7c7e2008-07-02 03:06:38539 See also <a href="githooks.html">githooks(5)</a>.
Junio C Hamano1a4e8412005-12-27 08:17:23540</p>
541</dd>
542<dt>
Junio C Hamano0c999702007-12-03 09:57:55543--allow-empty
544</dt>
545<dd>
546<p>
547 Usually recording a commit that has the exact same tree as its
Junio C Hamano58256872007-12-04 08:31:13548 sole parent commit is a mistake, and the command prevents you
549 from making such a commit. This option bypasses the safety, and
Junio C Hamano619596a2010-08-18 22:15:35550 is primarily for use by foreign SCM interface scripts.
Junio C Hamano0c999702007-12-03 09:57:55551</p>
552</dd>
553<dt>
Junio C Hamanocb39aea2010-05-09 07:24:48554--allow-empty-message
555</dt>
556<dd>
557<p>
558 Like --allow-empty this command is primarily for use by foreign
Junio C Hamano619596a2010-08-18 22:15:35559 SCM interface scripts. It allows you to create a commit with an
Junio C Hamanocb39aea2010-05-09 07:24:48560 empty commit message without using plumbing commands like
561 <a href="git-commit-tree.html">git-commit-tree(1)</a>.
562</p>
563</dd>
564<dt>
Junio C Hamano554da792007-12-27 03:29:58565--cleanup=&lt;mode&gt;
566</dt>
567<dd>
568<p>
569 This option sets how the commit message is cleaned up.
570 The <em>&lt;mode&gt;</em> can be one of <em>verbatim</em>, <em>whitespace</em>, <em>strip</em>,
571 and <em>default</em>. The <em>default</em> mode will strip leading and
572 trailing empty lines and #commentary from the commit message
573 only if the message is to be edited. Otherwise only whitespace
574 removed. The <em>verbatim</em> mode does not change message at all,
575 <em>whitespace</em> removes just leading/trailing whitespace lines
576 and <em>strip</em> removes both whitespace and commentary.
577</p>
578</dd>
579<dt>
Junio C Hamanoeb415992008-06-08 22:49:47580-e
581</dt>
582<dt>
583--edit
Junio C Hamano1a4e8412005-12-27 08:17:23584</dt>
585<dd>
586<p>
587 The message taken from file with <tt>-F</tt>, command line with
588 <tt>-m</tt>, and from file with <tt>-C</tt> are usually used as the
589 commit log message unmodified. This option lets you
590 further edit the message taken from these sources.
591</p>
592</dd>
593<dt>
Junio C Hamanobfe9e752006-04-05 21:43:28594--amend
595</dt>
596<dd>
597<p>
598 Used to amend the tip of the current branch. Prepare the tree
599 object you would want to replace the latest commit as usual
600 (this includes the usual -i/-o and explicit paths), and the
601 commit log editor is seeded with the commit message from the
602 tip of the current branch. The commit you create replaces the
603 current tip &#8212; if it was a merge, it will have the parents of
604 the current tip as parents &#8212; so the current top commit is
605 discarded.
606</p>
Junio C Hamanoba4b9282008-07-06 05:20:31607<div class="para"><p>It is a rough equivalent for:</p></div>
Junio C Hamanobfe9e752006-04-05 21:43:28608<div class="listingblock">
609<div class="content">
610<pre><tt> $ git reset --soft HEAD^
611 $ ... do something else to come up with the right tree ...
Junio C Hamano47ea30e2006-04-05 23:08:03612 $ git commit -c ORIG_HEAD
613</tt></pre>
Junio C Hamanobfe9e752006-04-05 21:43:28614</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31615<div class="para"><p>but can be used to amend a merge commit.</p></div>
Junio C Hamano7d06a8a2008-10-20 05:42:33616<div class="para"><p>You should understand the implications of rewriting history if you
617amend a commit that has already been published. (See the "RECOVERING
618FROM UPSTREAM REBASE" section in <a href="git-rebase.html">git-rebase(1)</a>.)</p></div>
Junio C Hamanobfe9e752006-04-05 21:43:28619</dd>
620<dt>
Junio C Hamanoeb415992008-06-08 22:49:47621-i
622</dt>
623<dt>
624--include
Junio C Hamano40f2f8d2006-02-07 08:04:39625</dt>
626<dd>
627<p>
Junio C Hamanoe7935c42006-12-13 21:32:17628 Before making a commit out of staged contents so far,
629 stage the contents of paths given on the command line
630 as well. This is usually not what you want unless you
631 are concluding a conflicted merge.
Junio C Hamano6697ac52006-02-14 08:00:23632</p>
633</dd>
634<dt>
Junio C Hamanoeb415992008-06-08 22:49:47635-o
636</dt>
637<dt>
638--only
Junio C Hamanoe79159d2008-04-12 08:23:17639</dt>
640<dd>
641<p>
642 Make a commit only from the paths specified on the
643 command line, disregarding any contents that have been
644 staged so far. This is the default mode of operation of
Junio C Hamano1aa40d22010-01-21 17:46:43645 <em>git commit</em> if any paths are given on the command line,
Junio C Hamanoe79159d2008-04-12 08:23:17646 in which case this option can be omitted.
647 If this option is specified together with <em>--amend</em>, then
Junio C Hamano54bf1e22008-12-20 06:30:11648 no paths need to be specified, which can be used to amend
Junio C Hamanoe79159d2008-04-12 08:23:17649 the last commit without committing changes that have
650 already been staged.
651</p>
652</dd>
653<dt>
Junio C Hamano4224f992008-06-23 07:14:08654-u[&lt;mode&gt;]
Junio C Hamanoeb415992008-06-08 22:49:47655</dt>
656<dt>
Junio C Hamano4224f992008-06-23 07:14:08657--untracked-files[=&lt;mode&gt;]
Junio C Hamano1e6e0062007-07-13 05:33:25658</dt>
659<dd>
660<p>
Junio C Hamano4224f992008-06-23 07:14:08661 Show untracked files (Default: <em>all</em>).
Junio C Hamano1e6e0062007-07-13 05:33:25662</p>
Junio C Hamanoba4b9282008-07-06 05:20:31663<div class="para"><p>The mode parameter is optional, and is used to specify
Junio C Hamanoe1cca182010-02-20 20:01:23664the handling of untracked files.</p></div>
665<div class="para"><p>The possible options are:</p></div>
Junio C Hamanoba4b9282008-07-06 05:20:31666<div class="ilist"><ul>
Junio C Hamano4224f992008-06-23 07:14:08667<li>
668<p>
669<em>no</em> - Show no untracked files
670</p>
671</li>
672<li>
673<p>
674<em>normal</em> - Shows untracked files and directories
675</p>
676</li>
677<li>
678<p>
679<em>all</em> - Also shows individual files in untracked directories.
680</p>
Junio C Hamanoba4b9282008-07-06 05:20:31681<div class="para"><p>See <a href="git-config.html">git-config(1)</a> for configuration variable
Junio C Hamano4224f992008-06-23 07:14:08682used to change the default for when the option is not
Junio C Hamanoba4b9282008-07-06 05:20:31683specified.</p></div>
Junio C Hamanoe1cca182010-02-20 20:01:23684</li>
685</ul></div>
Junio C Hamano1e6e0062007-07-13 05:33:25686</dd>
687<dt>
Junio C Hamanoeb415992008-06-08 22:49:47688-v
689</dt>
690<dt>
691--verbose
Junio C Hamano1e6e0062007-07-13 05:33:25692</dt>
693<dd>
694<p>
695 Show unified diff between the HEAD commit and what
696 would be committed at the bottom of the commit message
697 template. Note that this diff output doesn't have its
698 lines prefixed with <em>#</em>.
699</p>
700</dd>
701<dt>
Junio C Hamanoeb415992008-06-08 22:49:47702-q
703</dt>
704<dt>
705--quiet
Junio C Hamano7d23f5e2006-12-16 07:44:04706</dt>
707<dd>
708<p>
Junio C Hamanof9771f62007-01-17 17:42:30709 Suppress commit summary message.
Junio C Hamano7d23f5e2006-12-16 07:44:04710</p>
711</dd>
712<dt>
Junio C Hamano1bb31992009-08-29 04:24:08713--dry-run
714</dt>
715<dd>
716<p>
717 Do not create a commit, but show a list of paths that are
718 to be committed, paths with local changes that will be left
719 uncommitted and paths that are untracked.
720</p>
721</dd>
722<dt>
Junio C Hamano6ce6b6c2010-01-18 01:25:50723--status
724</dt>
725<dd>
726<p>
727 Include the output of <a href="git-status.html">git-status(1)</a> in the commit
728 message template when using an editor to prepare the commit
729 message. Defaults to on, but can be used to override
730 configuration variable commit.status.
731</p>
732</dd>
733<dt>
734--no-status
735</dt>
736<dd>
737<p>
738 Do not include the output of <a href="git-status.html">git-status(1)</a> in the
739 commit message template when using an editor to prepare the
740 default commit message.
741</p>
742</dd>
743<dt>
Junio C Hamano1bb569e2006-05-05 23:14:25744--
Junio C Hamano1a4e8412005-12-27 08:17:23745</dt>
746<dd>
747<p>
748 Do not interpret any more arguments as options.
749</p>
750</dd>
751<dt>
752&lt;file&gt;&#8230;
753</dt>
754<dd>
755<p>
Junio C Hamanoe7935c42006-12-13 21:32:17756 When files are given on the command line, the command
757 commits the contents of the named files, without
758 recording the changes already staged. The contents of
759 these files are also staged for the next commit on top
760 of what have been staged before.
Junio C Hamano1a4e8412005-12-27 08:17:23761</p>
762</dd>
Junio C Hamanoba4b9282008-07-06 05:20:31763</dl></div>
Junio C Hamano1a4e8412005-12-27 08:17:23764</div>
Junio C Hamanoae05fee2010-01-08 07:39:46765<h2 id="_date_formats">DATE FORMATS</h2>
766<div class="sectionbody">
767<div class="para"><p>The GIT_AUTHOR_DATE, GIT_COMMITTER_DATE environment variables
768and the <tt>--date</tt> option
769support the following date formats:</p></div>
770<div class="vlist"><dl>
771<dt>
772Git internal format
773</dt>
774<dd>
775<p>
776 It is <tt>&lt;unix timestamp&gt; &lt;timezone offset&gt;</tt>, where <tt>&lt;unix
777 timestamp&gt;</tt> is the number of seconds since the UNIX epoch.
778 <tt>&lt;timezone offset&gt;</tt> is a positive or negative offset from UTC.
779 For example CET (which is 2 hours ahead UTC) is <tt>+0200</tt>.
780</p>
781</dd>
782<dt>
783RFC 2822
784</dt>
785<dd>
786<p>
787 The standard email format as described by RFC 2822, for example
788 <tt>Thu, 07 Apr 2005 22:13:13 +0200</tt>.
789</p>
790</dd>
791<dt>
792ISO 8601
793</dt>
794<dd>
795<p>
796 Time and date specified by the ISO 8601 standard, for example
797 <tt>2005-04-07T22:13:13</tt>. The parser accepts a space instead of the
798 <tt>T</tt> character as well.
799</p>
800<div class="admonitionblock">
801<table><tr>
802<td class="icon">
803<div class="title">Note</div>
804</td>
805<td class="content">In addition, the date part is accepted in the following formats:
806<tt>YYYY.MM.DD</tt>, <tt>MM/DD/YYYY</tt> and <tt>DD.MM.YYYY</tt>.</td>
807</tr></table>
808</div>
809</dd>
810</dl></div>
811</div>
Junio C Hamanoba4b9282008-07-06 05:20:31812<h2 id="_examples">EXAMPLES</h2>
Junio C Hamano40f2f8d2006-02-07 08:04:39813<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31814<div class="para"><p>When recording your own work, the contents of modified files in
Junio C Hamanoe7935c42006-12-13 21:32:17815your working tree are temporarily stored to a staging area
Junio C Hamano1aa40d22010-01-21 17:46:43816called the "index" with <em>git add</em>. A file can be
Junio C Hamano361c1332007-11-14 12:17:22817reverted back, only in the index but not in the working tree,
Junio C Hamanofce7c7e2008-07-02 03:06:38818to that of the last commit with <tt>git reset HEAD &#8212; &lt;file&gt;</tt>,
Junio C Hamano1aa40d22010-01-21 17:46:43819which effectively reverts <em>git add</em> and prevents the changes to
Junio C Hamano361c1332007-11-14 12:17:22820this file from participating in the next commit. After building
821the state to be committed incrementally with these commands,
822<tt>git commit</tt> (without any pathname parameter) is used to record what
Junio C Hamanoe7935c42006-12-13 21:32:17823has been staged so far. This is the most basic form of the
Junio C Hamanoba4b9282008-07-06 05:20:31824command. An example:</p></div>
Junio C Hamanoe7935c42006-12-13 21:32:17825<div class="listingblock">
Junio C Hamano40f2f8d2006-02-07 08:04:39826<div class="content">
Junio C Hamanoe7935c42006-12-13 21:32:17827<pre><tt>$ edit hello.c
828$ git rm goodbye.c
829$ git add hello.c
830$ git commit</tt></pre>
Junio C Hamano40f2f8d2006-02-07 08:04:39831</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31832<div class="para"><p>Instead of staging files after each individual change, you can
Junio C Hamanoe7935c42006-12-13 21:32:17833tell <tt>git commit</tt> to notice the changes to the files whose
834contents are tracked in
835your working tree and do corresponding <tt>git add</tt> and <tt>git rm</tt>
836for you. That is, this example does the same as the earlier
Junio C Hamanoba4b9282008-07-06 05:20:31837example if there is no other change in your working tree:</p></div>
Junio C Hamanoe7935c42006-12-13 21:32:17838<div class="listingblock">
839<div class="content">
840<pre><tt>$ edit hello.c
841$ rm goodbye.c
842$ git commit -a</tt></pre>
843</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31844<div class="para"><p>The command <tt>git commit -a</tt> first looks at your working tree,
Junio C Hamanoe7935c42006-12-13 21:32:17845notices that you have modified hello.c and removed goodbye.c,
Junio C Hamanoba4b9282008-07-06 05:20:31846and performs necessary <tt>git add</tt> and <tt>git rm</tt> for you.</p></div>
847<div class="para"><p>After staging changes to many files, you can alter the order the
Junio C Hamanoe7935c42006-12-13 21:32:17848changes are recorded in, by giving pathnames to <tt>git commit</tt>.
849When pathnames are given, the command makes a commit that
Junio C Hamanoba4b9282008-07-06 05:20:31850only records the changes made to the named paths:</p></div>
Junio C Hamanoe7935c42006-12-13 21:32:17851<div class="listingblock">
852<div class="content">
853<pre><tt>$ edit hello.c hello.h
854$ git add hello.c hello.h
855$ edit Makefile
856$ git commit Makefile</tt></pre>
857</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31858<div class="para"><p>This makes a commit that records the modification to <tt>Makefile</tt>.
Junio C Hamanoe7935c42006-12-13 21:32:17859The changes staged for <tt>hello.c</tt> and <tt>hello.h</tt> are not included
860in the resulting commit. However, their changes are not lost &#8212;
861they are still staged and merely held back. After the above
Junio C Hamanoba4b9282008-07-06 05:20:31862sequence, if you do:</p></div>
Junio C Hamanoe7935c42006-12-13 21:32:17863<div class="listingblock">
864<div class="content">
865<pre><tt>$ git commit</tt></pre>
866</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31867<div class="para"><p>this second commit would record the changes to <tt>hello.c</tt> and
868<tt>hello.h</tt> as expected.</p></div>
Junio C Hamano1aa40d22010-01-21 17:46:43869<div class="para"><p>After a merge (initiated by <em>git merge</em> or <em>git pull</em>) stops
Junio C Hamanofce7c7e2008-07-02 03:06:38870because of conflicts, cleanly merged
Junio C Hamanoe7935c42006-12-13 21:32:17871paths are already staged to be committed for you, and paths that
872conflicted are left in unmerged state. You would have to first
Junio C Hamano1aa40d22010-01-21 17:46:43873check which paths are conflicting with <em>git status</em>
Junio C Hamanoe7935c42006-12-13 21:32:17874and after fixing them manually in your working tree, you would
Junio C Hamano1aa40d22010-01-21 17:46:43875stage the result as usual with <em>git add</em>:</p></div>
Junio C Hamanoe7935c42006-12-13 21:32:17876<div class="listingblock">
877<div class="content">
878<pre><tt>$ git status | grep unmerged
879unmerged: hello.c
880$ edit hello.c
881$ git add hello.c</tt></pre>
882</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31883<div class="para"><p>After resolving conflicts and staging the result, <tt>git ls-files -u</tt>
Junio C Hamanoe7935c42006-12-13 21:32:17884would stop mentioning the conflicted path. When you are done,
Junio C Hamanoba4b9282008-07-06 05:20:31885run <tt>git commit</tt> to finally record the merge:</p></div>
Junio C Hamanoe7935c42006-12-13 21:32:17886<div class="listingblock">
887<div class="content">
888<pre><tt>$ git commit</tt></pre>
889</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31890<div class="para"><p>As with the case to record your own changes, you can use <tt>-a</tt>
Junio C Hamanoe7935c42006-12-13 21:32:17891option to save typing. One difference is that during a merge
892resolution, you cannot use <tt>git commit</tt> with pathnames to
893alter the order the changes are committed, because the merge
894should be recorded as a single commit. In fact, the command
Junio C Hamanoba4b9282008-07-06 05:20:31895refuses to run when given pathnames (but see <tt>-i</tt> option).</p></div>
Junio C Hamanoe7935c42006-12-13 21:32:17896</div>
Junio C Hamanoba4b9282008-07-06 05:20:31897<h2 id="_discussion">DISCUSSION</h2>
Junio C Hamano775a0f42006-12-31 01:19:14898<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31899<div class="para"><p>Though not required, it's a good idea to begin the commit message
Junio C Hamano8f76dc62007-01-17 07:24:25900with a single short (less than 50 character) line summarizing the
901change, followed by a blank line and then a more thorough description.
902Tools that turn commits into email, for example, use the first line
Junio C Hamanoba4b9282008-07-06 05:20:31903on the Subject: line and the rest of the commit in the body.</p></div>
904<div class="para"><p>At the core level, git is character encoding agnostic.</p></div>
905<div class="ilist"><ul>
Junio C Hamano775a0f42006-12-31 01:19:14906<li>
907<p>
908The pathnames recorded in the index and in the tree objects
909 are treated as uninterpreted sequences of non-NUL bytes.
910 What readdir(2) returns are what are recorded and compared
911 with the data git keeps track of, which in turn are expected
912 to be what lstat(2) and creat(2) accepts. There is no such
913 thing as pathname encoding translation.
914</p>
915</li>
916<li>
917<p>
Junio C Hamano54bf1e22008-12-20 06:30:11918The contents of the blob objects are uninterpreted sequences
Junio C Hamano775a0f42006-12-31 01:19:14919 of bytes. There is no encoding translation at the core
920 level.
921</p>
922</li>
923<li>
924<p>
Junio C Hamano54bf1e22008-12-20 06:30:11925The commit log messages are uninterpreted sequences of non-NUL
Junio C Hamano775a0f42006-12-31 01:19:14926 bytes.
927</p>
928</li>
Junio C Hamanoba4b9282008-07-06 05:20:31929</ul></div>
930<div class="para"><p>Although we encourage that the commit log messages are encoded
Junio C Hamano775a0f42006-12-31 01:19:14931in UTF-8, both the core and git Porcelain are designed not to
932force UTF-8 on projects. If all participants of a particular
933project find it more convenient to use legacy encodings, git
934does not forbid it. However, there are a few things to keep in
Junio C Hamanoba4b9282008-07-06 05:20:31935mind.</p></div>
936<div class="olist"><ol>
Junio C Hamano775a0f42006-12-31 01:19:14937<li>
938<p>
Junio C Hamano1aa40d22010-01-21 17:46:43939<em>git commit</em> and <em>git commit-tree</em> issues
Junio C Hamano14b76482008-01-05 10:32:26940 a warning if the commit log message given to it does not look
Junio C Hamano775a0f42006-12-31 01:19:14941 like a valid UTF-8 string, unless you explicitly say your
942 project uses a legacy encoding. The way to say this is to
Junio C Hamano35bb3f62007-02-19 05:35:53943 have i18n.commitencoding in <tt>.git/config</tt> file, like this:
Junio C Hamano775a0f42006-12-31 01:19:14944</p>
945<div class="listingblock">
946<div class="content">
Junio C Hamano35bb3f62007-02-19 05:35:53947<pre><tt>[i18n]
Junio C Hamano775a0f42006-12-31 01:19:14948 commitencoding = ISO-8859-1</tt></pre>
949</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31950<div class="para"><p>Commit objects created with the above setting record the value
Junio C Hamano35bb3f62007-02-19 05:35:53951of <tt>i18n.commitencoding</tt> in its <tt>encoding</tt> header. This is to
Junio C Hamano775a0f42006-12-31 01:19:14952help other people who look at them later. Lack of this header
Junio C Hamanoba4b9282008-07-06 05:20:31953implies that the commit log message is encoded in UTF-8.</p></div>
Junio C Hamano775a0f42006-12-31 01:19:14954</li>
955<li>
956<p>
Junio C Hamano1aa40d22010-01-21 17:46:43957<em>git log</em>, <em>git show</em>, <em>git blame</em> and friends look at the
Junio C Hamanoaa17c7c2008-11-03 04:36:58958 <tt>encoding</tt> header of a commit object, and try to re-code the
959 log message into UTF-8 unless otherwise specified. You can
Junio C Hamano775a0f42006-12-31 01:19:14960 specify the desired output encoding with
Junio C Hamano35bb3f62007-02-19 05:35:53961 <tt>i18n.logoutputencoding</tt> in <tt>.git/config</tt> file, like this:
Junio C Hamano775a0f42006-12-31 01:19:14962</p>
963<div class="listingblock">
964<div class="content">
Junio C Hamano35bb3f62007-02-19 05:35:53965<pre><tt>[i18n]
Junio C Hamano775a0f42006-12-31 01:19:14966 logoutputencoding = ISO-8859-1</tt></pre>
967</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31968<div class="para"><p>If you do not have this configuration variable, the value of
969<tt>i18n.commitencoding</tt> is used instead.</p></div>
Junio C Hamano775a0f42006-12-31 01:19:14970</li>
Junio C Hamanoba4b9282008-07-06 05:20:31971</ol></div>
972<div class="para"><p>Note that we deliberately chose not to re-code the commit log
Junio C Hamano775a0f42006-12-31 01:19:14973message when a commit is made to force UTF-8 at the commit
974object level, because re-coding to UTF-8 is not necessarily a
Junio C Hamanoba4b9282008-07-06 05:20:31975reversible operation.</p></div>
Junio C Hamano775a0f42006-12-31 01:19:14976</div>
Junio C Hamanoba4b9282008-07-06 05:20:31977<h2 id="_environment_and_configuration_variables">ENVIRONMENT AND CONFIGURATION VARIABLES</h2>
Junio C Hamanoe7935c42006-12-13 21:32:17978<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31979<div class="para"><p>The editor used to edit the commit log message will be chosen from the
Junio C Hamanof6002a92007-07-20 10:28:22980GIT_EDITOR environment variable, the core.editor configuration variable, the
981VISUAL environment variable, or the EDITOR environment variable (in that
Junio C Hamano3b70d3c2009-11-21 17:37:37982order). See <a href="git-var.html">git-var(1)</a> for details.</p></div>
Junio C Hamanoe7935c42006-12-13 21:32:17983</div>
Junio C Hamanoba4b9282008-07-06 05:20:31984<h2 id="_hooks">HOOKS</h2>
Junio C Hamanoe7935c42006-12-13 21:32:17985<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31986<div class="para"><p>This command can run <tt>commit-msg</tt>, <tt>prepare-commit-msg</tt>, <tt>pre-commit</tt>,
Junio C Hamanofce7c7e2008-07-02 03:06:38987and <tt>post-commit</tt> hooks. See <a href="githooks.html">githooks(5)</a> for more
Junio C Hamanoba4b9282008-07-06 05:20:31988information.</p></div>
Junio C Hamanoe7935c42006-12-13 21:32:17989</div>
Junio C Hamanoba4b9282008-07-06 05:20:31990<h2 id="_see_also">SEE ALSO</h2>
Junio C Hamanoe7935c42006-12-13 21:32:17991<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31992<div class="para"><p><a href="git-add.html">git-add(1)</a>,
Junio C Hamanoe7935c42006-12-13 21:32:17993<a href="git-rm.html">git-rm(1)</a>,
994<a href="git-mv.html">git-mv(1)</a>,
995<a href="git-merge.html">git-merge(1)</a>,
Junio C Hamanoba4b9282008-07-06 05:20:31996<a href="git-commit-tree.html">git-commit-tree(1)</a></p></div>
Junio C Hamano40f2f8d2006-02-07 08:04:39997</div>
Junio C Hamanoba4b9282008-07-06 05:20:31998<h2 id="_author">Author</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23999<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:311000<div class="para"><p>Written by Linus Torvalds &lt;torvalds@osdl.org&gt; and
Junio C Hamano0868a302008-07-22 09:20:441001Junio C Hamano &lt;gitster@pobox.com&gt;</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231002</div>
Junio C Hamanoba4b9282008-07-06 05:20:311003<h2 id="_git">GIT</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231004<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:311005<div class="para"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231006</div>
1007<div id="footer">
1008<div id="footer-text">
Junio C Hamanoac752fa2010-09-19 00:01:001009Last updated 2010-09-18 23:56:37 UTC
Junio C Hamano1a4e8412005-12-27 08:17:231010</div>
1011</div>
1012</body>
1013</html>